package com.team.service.impl;
import com.team.dao.KindMapper;
import com.team.dao.NewsMapper;
import com.team.dao.StatusMapper;
import com.team.entity.Kind;
import com.team.entity.News;
import com.team.entity.Status;
import com.team.service.NewsSpecialService;
import com.team.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author keluoyisi
 * @program: seven
 * @description:
 * @date 2022-10-17 16:53:36
 */
@Service
public class NewsSpecialServiceImpl implements NewsSpecialService {
    @Autowired
    private KindMapper kindMapper;
    @Autowired
    private NewsMapper newsMapper;
    @Autowired
    private StatusMapper statusMapper;
    /**
     * @param :
     * @return Result
     * @description 获取到所有的kind
     */
    @Override
    public Result kindAll() {
        List<Kind> kinds = kindMapper.selectKinds();
        return new Result(200,"查询成功",kinds);
    }

    /**
     * @param news:
     * @return Result
     * @description  添加新闻
     */
    @Override
    public Result addnews(News news) {
        System.out.println(news);
        newsMapper.insertNews(news);
        return new Result(200,"添加成功");
    }

    /**
     * @param :
     * @return Result
     * @description 获取到所有的kind
     */
    @Override
    public Result statusAll() {
        List<Status> list = statusMapper.selectStatusAll();
        return new Result(200,"成功",list);
    }
}
